package com.school.demo.mapper.auto;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.school.demo.model.auto.Activities;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Charlotte
 * @since 2021-02-28
 */
public interface ActivitiesMapper extends BaseMapper<Activities> {

    @Results(id="stuMap",value = {
            @Result(property = "id",column = "id"),
            @Result(property = "origanizationId",column = "origanization_id"),
            @Result(property = "upTime",column = "up_time"),
            @Result(property = "viewNum",column = "view_num"),
            @Result(property = "content",column = "content"),
            @Result(property = "label",column = "label"),
            @Result(property = "title",column = "title"),
            @Result(property = "status",column = "status"),
            @Result(property = "isSetJoinNum",column = "is_set_join_num"),
            @Result(property = "imgs",column = "imgs"),
            @Result(property = "column11",column = "column_11"),
            @Result(property = "column12",column = "column_12"),
            @Result(property = "organization",column = "origanization_id",one = @One(select = "com.school.demo.model.auto.Organization"))
    })


    @Select("SELECT * FROM ACTIVITIES WHERE ID=#{id}")
    Activities findById(int id);

    @Select("select * from ACTIVITIES where 1=1 and " +
            "${ew.sqlSegment}")
    @ResultMap(value = "stuMap")
    List<Activities> selectStudents(@Param("ew") QueryWrapper<Activities> wrapper);

}
